<?php
Yii::import ( 'ext\simpleHtmlDom\simple_html_dom', true );
/**
 * html dom方式采集类
 * @author CallMeZ
 *
 */
class Pager extends simple_html_dom_node {
	public static function getHtmlFile($url, $use_include_path = false, $context = null, $offset = -1, $maxLen = -1, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT) {
		$dom = new simple_html_dom ( null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText );
		$contents = file_get_contents ( $url, $use_include_path, $context, $offset );
		if (empty ( $contents ) || strlen ( $contents ) > MAX_FILE_SIZE) {
			return false;
		}
		$dom->load ( $contents, $lowercase, $stripRN );
		return $dom;
	}
	public static function getHtmlStr($str, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT) {
		$dom = new simple_html_dom ( null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText );
		if (empty ( $str ) || strlen ( $str ) > MAX_FILE_SIZE) {
			$dom->clear ();
			return false;
		}
		$dom->load ( $str, $lowercase, $stripRN );
		return $dom;
	}
	
	public static function dumpHtmlTree($node, $show_attr = true, $deep = 0) {
		$node->dump ( $node );
	}
}
?>